import { useDict } from '@/composables/useDict'
import type { TableColums, FormItemRows } from '@meetjs/element-plus-kit'
import { ATHLETE_DICT } from '@/constants/dictKeys'

const { dicts, trainOrgOptions } = useDict([ATHLETE_DICT.PROJECT])

// 表格列配置
export const tableColumns: TableColums[] = [
	{
		prop: 'trainOrgLabel',
		label: '在训单位',
		minWidth: 150,
		align: 'center'
	},
	{
		prop: 'trainProjectLabel',
		label: '训练项目',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'coachName',
		label: '教练名称',
		minWidth: 100,
		align: 'center'
	},
	{
		prop: 'startTime',
		label: '训练开始时间',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'endTime',
		label: '训练结束时间',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'coachAppraise',
		label: '教练评价',
		minWidth: 150,
		align: 'center'
	},
	{
		prop: 'remark',
		label: '备注',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'action',
		label: '操作',
		minWidth: 160,
		fixed: 'right',
		align: 'center'
	}
]

// 表单配置 - 自动布局
export const formOptions: FormItemRows[] = [
	{
		type: 'select',
		label: '在训单位',
		prop: 'trainOrgId',
		required: true,
		options: trainOrgOptions as unknown as any,
		attrs: {
			placeholder: '请输入在训单位',
			filterable: true
		}
	},
	{
		type: 'select',
		label: '训练项目',
		prop: 'trainProject',
		required: true,
		options: dicts[ATHLETE_DICT.PROJECT] as unknown as any
	},
	{
		type: 'input',
		label: '教练名称',
		prop: 'coachName',
		required: true,
		attrs: {
			placeholder: '请输入教练姓名',
			maxlength: 50
		}
	},
	{
		type: 'date-picker',
		label: '训练开始时间',
		prop: 'startTime',
		required: true,
		attrs: {
			type: 'date',
			placeholder: '请选择开始时间',
			format: 'YYYY-MM-DD',
			'value-format': 'YYYY-MM-DD'
		}
	},
	{
		type: 'date-picker',
		label: '训练结束时间',
		prop: 'endTime',
		required: true,
		attrs: {
			type: 'date',
			placeholder: '请选择结束时间',
			format: 'YYYY-MM-DD',
			'value-format': 'YYYY-MM-DD'
		}
	},
	{
		type: 'textarea',
		label: '教练评价',
		prop: 'coachAppraise',
		attrs: {
			placeholder: '请输入教练评价',
			rows: 2,
			maxlength: 300,
			'show-word-limit': true
		}
	},
	{
		type: 'textarea',
		label: '备注',
		prop: 'remark',
		attrs: {
			placeholder: '请输入备注信息',
			rows: 3,
			maxlength: 500,
			'show-word-limit': true
		}
	}
]
